#!/bin/sh

set -ex

JVM_OPTS="${JVM_OPTS:--Xms2048m -Xmx2048m -Xmn1024m -XX:SurvivorRatio=2}"

JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=${DEBUG_PORT} ${JVM_OPTS}"
JAVA_OPTS="${JAVA_OPTS} -Dfile.encoding=utf-8 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/export/data/braindata/${APP_NAME}.hprof"

exec java ${JAVA_OPTS} -jar ${APP_NAME}.jar "$@"
